<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    button {
      background-color: rgb(37, 221, 37);
      color: #fff;
      border-radius: 6%;
      border: 1px solid rgb(37, 221, 37);
      height: 60px;
      width: 80px;
    }
  </style>
</head>

<body>
  <button>剁手按钮</button>
  <script>
    const button = document.querySelector('button')

    const payMoney = function () {
      console.log('剁手成功');
      console.log(this);
    }

    const debounce = (fun, time) => {
      let timer
      return () => {
        // const that = this
        clearTimeout(timer)
        timer = setTimeout(() => {
          fun()
        }, time);
      }
    }

    button.addEventListener('click', debounce(payMoney, 1000))
    // button.addEventListener('click', payMoney)
  </script>
</body>

</html>